#include<bits/stdc++.h>
using namespace std;
int a[100005],cnt[100005],cntcnt2[100005];
int main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	int n;cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		cnt[a[i]]++;
	}
	for(int i=100003;i>=0;i--){
		cntcnt2[i]=cntcnt2[i+1]+cnt[i];
	}
	//cout<<cntcnt2[2]<<endl;
	//cout<<cnt[2]<<endl;
	int ct=n;
	for(int i=1;i<=100004;i++){
		//if(i<=2) cout<<ct<<' '<<cnt[i]<<' '<<cntcnt2[i]<<endl;
		if(ct>cntcnt2[i]&&cnt[i]) {
			if(cnt[i]>ct-cntcnt2[i])
				ct=cntcnt2[i];
			else
				ct-=cnt[i];
		}
	}
	cout<<ct;
}
